<template>
  <div class="tjc">
    <div class="head">
      <div class="tit">视频实时画面</div>
    </div>
    <div class="ec">
      <div class="left">
        <div class="bc" v-for="(item, index) in state.data" :key="index">
          <el-button :class="index == state.inx ? 'cusb2' : 'cusb1'" :style="'width:75px;margin-left:' + (index == 0 ? 3 : 0) + 'px'" @click="change(item,index)">
            {{ item.cameraName }}
          </el-button>
        </div>
      </div>
      <div class="right">
        <onem :vid="state.vid" />
      </div>
    </div>
    <div class="foot">
      <span class="tit">监控位置</span>
      <span class="txt">{{ state.data[state.inx]?.cameraName }}</span>
      <span class="tit">监控状态</span>
      <span class="txt">正常运行</span>
    </div>
  </div>
</template>

<script setup>
const props = defineProps({
  vid: String
});
const state = reactive({
  pm: { type: '1' },
  vid: '',
  inx: 0,
  data: []
})
const getData = () => {
  useApi.post("/arhome/dashboard/lowlist", { highCameraId: props.vid }).then((res) => {
    state.data = res.data.lowCameraList
    if (state.data.length > 0) {
      state.vid = state.data[0].cameraId
    }
  });
}
const change = (item,index) => {
  state.vid = item.cameraId;
  state.inx = index
}
onMounted(() => {
  getData()
})
</script>

<style lang="scss" scoped>
.tjc {
  width: 380px;
  height: 282px;
  background-image: url('/images/bgtj.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  padding: 10px;
}

.head {
  display: flex;
  height: 30px;
  margin-top: 10px;
  border-bottom: 1px solid #5FB1E8;

  .tit {
    margin-left: 100px;
    width: 180px;
    display: flex;
    justify-content: center;
    font-weight: 500;
    font-size: 16px;
    color: #FFFFFF;
    line-height: 22px;
  }

  .opt {
    width: 100px;
    text-align: right;
  }
}

.ec {
  margin-top: 2px;
  height: 175px;
  border-bottom: 1px solid #5FB1E8;
  display: flex;

  .left {
    width: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
  }

  .right {
    width: 260px;
    height: 100%;
    padding: 5px;
  }
}

.foot {
  height: 40px;
  padding: 10px;
  display: flex;
  align-items: center;

  .tit {
    width: 70px;
    font-weight: 600;
    font-size: 14px;
    color: #FFAD1E;
  }

  .txt {
    width: 110px;
    font-weight: 600;
    font-size: 12px;
    color: #FFFFFF;
  }
}

:deep(.el-select) {
  width: 80px;
  margin-top: -4px;
  --el-input-text-color: #ffffff;
  --el-select-input-color: #ffffff;

  .el-select__wrapper {
    background: transparent;
    color: #FFFFFF;
    border: none;
    box-shadow: none;
    border-radius: 0px !important;
  }
}</style>